import 'dart:ui';

import 'package:demo/base/hex_color.dart';

class AppColors {
  static Color primaryWhite({AppOpacity? opacity}) {
    return getColorWithOpacity(
      const Color.fromARGB(255, 255, 255, 255),
      opacity,
    );
  }

  static Color primary({AppOpacity? opacity}) {
    return getColorWithOpacity(
      HexColor("##7198FF"),
      opacity,
    );
  }

  static Color blue({AppOpacity? opacity}) {
    return getColorWithOpacity(
      HexColor("#00A3FF"),
      opacity,
    );
  }

  static Color black({AppOpacity? opacity}) {
    return getColorWithOpacity(
      HexColor("#333333"),
      opacity,
    );
  }

  static Color darkBlack({AppOpacity? opacity}) {
    return getColorWithOpacity(
      HexColor("#595959"),
      opacity,
    );
  }

  static Color lightBlack({AppOpacity? opacity}) {
    return getColorWithOpacity(
      HexColor("#7b7b7b"),
      opacity,
    );
  }

  static Color getColorWithOpacity(
    Color color,
    AppOpacity? opacity,
  ) =>
      opacity == null ? color : opacity.apply(color);
}

class AppOpacity {
  final double opacity;

  AppOpacity(this.opacity);

  Color apply(Color color) => color.withOpacity(opacity);

  ///1.0
  static final AppOpacity highEmphasis = AppOpacity(1.0);

  ///0.8
  static final AppOpacity pressed = AppOpacity(0.8);

  ///0.6
  static final AppOpacity mediumEmphasis = AppOpacity(0.6);

  ///0.4
  static final AppOpacity disabled = AppOpacity(0.4);

  ///0.6
  static final AppOpacity typeLowEmphasis = AppOpacity(0.6);

  ///0.2
  static final AppOpacity lowEmphasis = AppOpacity(0.2);

  ///0.1
  static final AppOpacity overlay = AppOpacity(0.1);

  ///0.0
  static final AppOpacity zero = AppOpacity(0.0);
}
